package cn.com.cnxfs.relaxchat.controller;

import cn.com.cnxfs.relaxchat.entity.Friend;
import cn.com.cnxfs.relaxchat.service.IFriendService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping(value = "/friend")
public class FriendController {
    @Autowired
    private IFriendService iFriendService;

    @RequestMapping(value="/list",method = RequestMethod.POST)
    private List<Friend> list(@RequestParam int uid){
        return iFriendService.list(uid);
    }

    @RequestMapping(value="/add",method = RequestMethod.POST)
    private void add(@RequestParam int uid, @RequestParam int friend){
        iFriendService.add(uid, friend);
    }

    @RequestMapping(value="/black",method = RequestMethod.POST)
    private void black(@RequestParam int id){
        iFriendService.black(id);
    }

    @RequestMapping(value="/deny",method = RequestMethod.POST)
    private void deny(@RequestParam int id){
        iFriendService.deny(id);
    }
}
